﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using ProjectBase.Core;
using ProjectBase.Tools.Publishing;
using ProjectBase.Tools.Publishing.Handlers.ExceptionHandler;
using $safeprojectname$.Infrastructure.Exceptions;

namespace $safeprojectname$.Infrastructure.Factories
{
    public static class HandlerFactory
    {
        #region GetProviders
        public static ExceptionPublishingHandler DefaultHandler()
        {
            var config = ExceptionConfigurationReader.ForDefault();
            return CreateHandler(config);
        }

        public static ExceptionPublishingHandler HandlerWithBrokenEventId()
        {
            var config = ExceptionConfigurationReader.ForBrokenEventId();
            return CreateHandler(config);
        }

        public static ExceptionPublishingHandler HandlerWithExceptionMissing()
        {
            var config = ExceptionConfigurationReader.ForExceptionMissing();
            return CreateHandler(config);
        }

        public static ExceptionPublishingHandler CreateHandler(ExceptionConfiguration configuration)
        {
            var handler = new ExceptionPublishingHandler();
            handler.Init("ProjectBaseApplication", "ProjectBaseLog", configuration);

            return handler;
        }

        #endregion GetProviders
    }
}
